<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="javascript:;" onclick="bid()" id="bib_sub">出价</a>
</body>
<script>
    function bid(){
        document.getElementById('bib_sub').onclick = null; // 解绑onclick事件

        var index = layer.load(2, {shade: false});
        // var goods_id = {$goods_id};
        var raise_price = $('#raise_price').val();//当前价加价
        $.ajax({
            type: 'POST',
            url:"4444",
            data:{'goods_id':goods_id,'price':raise_price},
            cache:false,
            dataType: 'json',
            success: function (data){
                layer.close(index);
                if(data.code == 200){
                    layer.alert(data.msg, {icon: 6},function(){
                        location.reload();
                    });
                    return false;
                }
                layer.msg(data.msg,{time:2000});
                // 绑定onclick点击事件
                document.getElementById('bib_sub').onclick = function () {
                    bid();
                }
            }
        });
    }
</script>
</html>
